package com.rd.student.ruanjian.class4.zhouzihe.day0803;

import java.util.ArrayList;
import java.util.Scanner;

public class TestArrayList {
    public static void main(String[] args) {
        ArrayList<Animal> a1 = new ArrayList<>(18);
        String[] arrName ={"小1","小2","小3","小四","小五","小6","小7","小8","小9","小10","小11","小12","小13","小14","小15","小16","小17","小18"};
        String[] furColor={"黄色","蓝色","白色","紫色","黑色"};
        String[] eyeColor={"黄色","蓝色","白色"};
        for (int i = 0; i < 10; i++) {
            int index = (int) (Math.random()*furColor.length);
            a1.add(new Dog(arrName[i],furColor[index]));
        }
        for (int i = 10; i < 15; i++) {
            int index1 = (int) (Math.random()*eyeColor.length);
            a1.add(new Cat(arrName[i],eyeColor[index1]));
        }
        for (int i = 15; i <18 ; i++) {
            a1.add(new Pig(arrName[i]));
        }



        for (int i = 0; i < a1.size(); i++) {
            System.out.println(a1.get(i));
        }

        int random = (int) (Math.random() * a1.size());
        System.out.println(a1.get(random));

        System.out.println("--------");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请选择你要的宠物序号");
        int n = scanner.nextInt();

        Lady lady = new Lady("张女士", a1.get(n));
        System.out.println(lady + "选择的宠物是:" + a1.get(n).getName());
        a1.get(n).enjoy();
    }
}